package com.ruoyi.boat.dto;

/**
 * 手自动切换、北斗目标地址切换、发送模式切换、跑偏半径设置、航迹点设置、航路自动规划、数据自毁、电机转速等。 ? 舵角
 * mode address send radius point path destroy rotation angle
 */
public enum CmdType {
    SWITCH_MODE("mode"),
    CHANGE_BEIDOU_ADDRESS("address"),
    SWITCH_SEND_MODE("send"),
    SET_RADIUS("radius"),
    SET_POINT("point"),
    PATH_PLANING("path"),
    DATA_DESTRUCTION("destroy"),
    ROTATING_SPEED("rotation"),
    SET_RUDDER_ANGLE("angle"),
    LOAD_POWER("load");

    private final String code;

    CmdType(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    // 根据code返回枚举类型,主要在switch中使用
    public static CmdType getByCode(String code) {
        for (CmdType cmdType : values()) {
            if (cmdType.getCode().equals(code)) {
                return cmdType;
            }
        }
        return null;
    }
}